<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<title>List</title>
<!-- for-mobile-apps -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false);
		function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- //for-mobile-apps -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" href="css/faqstyle.css" type="text/css" media="all" />
<link href="css/medile.css" rel='stylesheet' type='text/css' />
<link href="css/single.css" rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/contactstyle.css" type="text/css" media="all" />
<!-- news-css -->
<link rel="stylesheet" href="news-css/news.css" type="text/css" media="all" />
<!-- //news-css -->
<!-- list-css -->
<link rel="stylesheet" href="list-css/list.css" type="text/css" media="all" />

<!-- //list-css -->
<!-- font-awesome icons -->
<link rel="stylesheet" href="css/font-awesome.min.css" />
<!-- //font-awesome icons -->
<!-- js -->
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<!-- //js -->
<!---<link href='http://fonts.googleapis.com/css?family=Roboto+Condensed:400,700italic,700,400italic,300italic,300' rel='stylesheet' type='text/css'>--->
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$(".scroll").click(function(event){		
			event.preventDefault();
			$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
		});
	});
</script>
<!-- start-smoth-scrolling -->
<!-- tables -->
<link rel="stylesheet" type="text/css" href="list-css/table-style.css" />
<link rel="stylesheet" type="text/css" href="list-css/basictable.css" />
<script type="text/javascript" src="list-js/jquery.basictable.min.js"></script>
 <script type="text/javascript">
    $(document).ready(function() {
      $('#table').basictable();

      $('#table-breakpoint').basictable({
        breakpoint: 768
      });
	   $('#table-breakpoint1').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint2').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint3').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint4').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint5').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint6').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint7').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint8').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint9').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint10').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint11').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint12').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint13').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint14').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint15').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint16').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint17').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint18').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint19').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint20').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint21').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint22').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint23').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint24').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint25').basictable({
        breakpoint: 768
      });
	  $('#table-breakpoint26').basictable({
        breakpoint: 768
      });
    });
  </script>
<!-- //tables -->
</head>
	
<body>
<!-- header -->

<!-- //header -->
<!-- bootstrap-pop-up -->
	
	<script>
		$('.toggle').click(function(){
		  // Switches the Icon
		  $(this).children('i').toggleClass('fa-pencil');
		  // Switches the forms  
		  $('.form').animate({
			height: "toggle",
			'padding-top': 'toggle',
			'padding-bottom': 'toggle',
			opacity: "toggle"
		  }, "slow");
		});
	</script>
<!-- //bootstrap-pop-up -->
<!-- nav -->
	
<!-- //nav -->

<!-- faq-banner -->
		<div class="faq">
		<h4 class="latest-text w3_faq_latest_text w3_latest_text">所有电影</h4>
			<div class="container">
				<div class="agileits-news-top">
					<ol class="breadcrumb">
					  <li><a href="index.html">主页</a></li>
					  <li class="active">影集</li>
					</ol>
				</div>
				<div class="bs-example bs-example-tabs" role="tabpanel" data-example-id="togglable-tabs">
						<ul id="myTab" class="nav nav-tabs" role="tablist">
							<li role="presentation" class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">全部</a></li>
							<li role="presentation"><a href="#a" role="tab" id="a-tab" data-toggle="tab" aria-controls="a" class="spell">A</a></li>
							<li role="presentation"><a href="#b" role="tab" id="b-tab" data-toggle="tab" aria-controls="b" class="spell">B</a></li>
							<li role="presentation"><a href="#c" role="tab" id="c-tab" data-toggle="tab" aria-controls="c" class="spell">C</a></li>
							<li role="presentation"><a href="#d" role="tab" id="d-tab" data-toggle="tab" aria-controls="d" class="spell">D</a></li>
							<li role="presentation"><a href="#e" role="tab" id="e-tab" data-toggle="tab" aria-controls="e" class="spell">E</a></li>
							<li role="presentation"><a href="#f" role="tab" id="f-tab" data-toggle="tab" aria-controls="f" class="spell">F</a></li>
							<li role="presentation"><a href="#g" role="tab" id="g-tab" data-toggle="tab" aria-controls="g" class="spell">G</a></li>
							<li role="presentation"><a href="#h" role="tab" id="h-tab" data-toggle="tab" aria-controls="h" class="spell">H</a></li>
							<li role="presentation"><a href="#i" role="tab" id="i-tab" data-toggle="tab" aria-controls="i" class="spell">I</a></li>
							<li role="presentation"><a href="#j" role="tab" id="j-tab" data-toggle="tab" aria-controls="j" class="spell">J</a></li>
							<li role="presentation"><a href="#k" role="tab" id="k-tab" data-toggle="tab" aria-controls="k" class="spell">K</a></li>
							<li role="presentation"><a href="#l" role="tab" id="l-tab" data-toggle="tab" aria-controls="l" class="spell">L</a></li>
							<li role="presentation"><a href="#m" role="tab" id="m-tab" data-toggle="tab" aria-controls="m" class="spell">M</a></li>
							<li role="presentation"><a href="#n" role="tab" id="n-tab" data-toggle="tab" aria-controls="n" class="spell">N</a></li>
							<li role="presentation"><a href="#o" role="tab" id="o-tab" data-toggle="tab" aria-controls="o" class="spell">O</a></li>
							<li role="presentation"><a href="#p" role="tab" id="p-tab" data-toggle="tab" aria-controls="p" class="spell">P</a></li>
							<li role="presentation"><a href="#q" role="tab" id="q-tab" data-toggle="tab" aria-controls="q" class="spell">Q</a></li>
							<li role="presentation"><a href="#r" role="tab" id="r-tab" data-toggle="tab" aria-controls="r" class="spell">R</a></li>
							<li role="presentation"><a href="#s" role="tab" id="s-tab" data-toggle="tab" aria-controls="s" class="spell">S</a></li>
							<li role="presentation"><a href="#t" role="tab" id="t-tab" data-toggle="tab" aria-controls="t" class="spell">T</a></li>
							<li role="presentation"><a href="#u" role="tab" id="u-tab" data-toggle="tab" aria-controls="u" class="spell">U</a></li>
							<li role="presentation"><a href="#v" role="tab" id="v-tab" data-toggle="tab" aria-controls="v" class="spell">V</a></li>
							<li role="presentation"><a href="#w" role="tab" id="w-tab" data-toggle="tab" aria-controls="w" class="spell">W</a></li>
							<li role="presentation"><a href="#x" role="tab" id="x-tab" data-toggle="tab" aria-controls="x" class="spell">X</a></li>
							<li role="presentation"><a href="#y" role="tab" id="y-tab" data-toggle="tab" aria-controls="y" class="spell">Y</a></li>
							<li role="presentation"><a href="#z" role="tab" id="z-tab" data-toggle="tab" aria-controls="z" class="spell">Z</a></li>
						</ul>
						<div id="myTabContent" class="tab-content">
							<div role="tabpanel" class="tab-pane fade in active" id="home" aria-labelledby="home-tab">
								<div class="agile-news-table">
									<div class="w3ls-news-result">
										<h4>电影浏览 <span></span></h4>
									</div>
									<table id="table-breakpoint">
										<thead>
										  <tr>
											<th>No.</th>
											<th>电影名</th>
											<th>年份</th>
											<th>时长</th>
											<th>国家</th>
											<th>类型</th>
											<th>评分</th>
										  </tr>
										</thead>
										<tbody id="movieslist">
										  <tr>
											<td>1</td>
											<td class="w3-list-img"><a href="single.html"><img src="images/n1.jpg" alt="" /> <span>01 Ben-Hur</span></a></td>
											<td>2013</td>
											<td>HD</td>
											<td class="w3-list-info"><a href="genres.html">United Kingdom</a></td>
											<td class="w3-list-info"><a href="comedy.html">Comedy, Drama</a></td>
											<td>7.0</td>
										  </tr>
									

										</tbody>
									</table>
								</div>
							</div>

							           
											<div class="blog-pagenat-wthree" >
							<ul id="blog-pagenats">
								<li><a class="frist" href="#">Prev</a></li>
								<li><a href="#">1</a></li>
								<li><a href="#">2</a></li>
								<li><a href="#">3</a></li>
								<li><a href="#">4</a></li>
								<li><a href="#">5</a></li>
								<li><a class="last" href="#">Next</a></li>
							</ul>
						</div>	
					

						</div>
				</div>
			</div>
	</div>
<!-- //faq-banner -->
<!-- footer -->
	
<!-- //footer -->
<!-- Bootstrap Core JavaScript -->
<script src="js/bootstrap.min.js"></script>
<script>
$(document).ready(function(){
    $(".dropdown").hover(            
        function() {
            $('.dropdown-menu', this).stop( true, true ).slideDown("fast");
            $(this).toggleClass('open');        
        },
        function() {
            $('.dropdown-menu', this).stop( true, true ).slideUp("fast");
            $(this).toggleClass('open');       
        }
    );
});
</script>
<!-- //Bootstrap Core JavaScript -->
<!-- here stars scrolling icon -->
	<script type="text/javascript">
		$(document).ready(function() {
			//点击量
			$(document).on("click",".movie",function(){
				var i=$(this).attr("data-id");

				
				 $.ajax({
				     
			         type: "POST",//方法类型
			         dataType: "json",//预期服务器返回的数据类型
			         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
			         data:{op:"addCount",id:i},
			         success: function (result,status,xhr) {

			         } ,
			         error : function() {
			             alert("错误！");
			         }
			     });
			});	
			$().UItoTop({ easingType: 'easeOutQuart' });
				
			
			
			 $.ajax({
			     
		         type: "POST",//方法类型
		         dataType: "json",//预期服务器返回的数据类型
		         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
		         data:{op:"findAll",pageNum:1,pageSize:8},
		         success: function (result,status,xhr) {
		        	 var val=eval(result);
		        	 var movie=val.movies;

		        	 show(movie);
		         } ,
		         error : function() {
		             alert("错误！");
		         }
		     });
	
				$(document).on("click","#home-tab",function(){
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findAll",pageNum:1,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;

				        	 show(movie);
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click",".page",function(){
					var i=$(this).text();
					
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findAll",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 show(movie);
				        	 
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click","#pre",function(){
					var i=$("#pageNum").text();
					if(i==1){
						i=1;
					}if(i>1){
						i=i-1;
					}
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findAll",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 show(movie);
				        	 
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click","#next",function(){
					var i=$("#pageNum").text();
					
					if(parseInt(i)<$("#total").text()){
						i=parseInt(i)+parseInt(1);
					}if(i==$("#total").text()){
						i=$("#total").text();
					}
					
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findAll",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 
				        	 show(movie);
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				//字母查询---------------------------------------------------------------------------
				$(document).on("click",".spell",function(){
					var spell=$(this).attr("aria-controls");
					
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findBySpell",pageNum:1,pageSize:8,spell:spell},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 show2(movie);
				        	 
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click",".page2",function(){
					var i=$(this).text();
					
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findBySpell2",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie2=val.movies;
				        	 show2(movie);
				        	 
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click","#pre2",function(){
					var i=$("#pageNum").text();
					if(i==1){
						i=1;
					}if(i>1){
						i=i-1;
					}
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findBySpell2",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 show2(movie);
				        	 
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
				$(document).on("click","#next2",function(){
					var i=$("#pageNum").text();
					
					if(parseInt(i)<$("#total").text()){
						i=parseInt(i)+1;
					}if(i==$("#total").text()){
						i=$("#total").text();
					}
					
					 $.ajax({
					     
				         type: "POST",//方法类型
				         dataType: "json",//预期服务器返回的数据类型
				         url: "${pageContext.request.contextPath}/AdminServlet" ,//url
				         data:{op:"findBySpell2",pageNum:i,pageSize:8},
				         success: function (result,status,xhr) {
				        	 var val=eval(result);
				        	 var movie=val.movies;
				        	 
				        	 show2(movie);
				         } ,
				         error : function() {
				             alert("错误！");
				         }
				     });
				});
			});
		function show(result){
			// 清空表格原始数据
			$("#blog-pagenats").empty();
			// 渲染表格中的数据
			
				// 渲染表格数据
				showData(result.data);
				$("#blog-pagenats").append("<div style=\"visibility:hidden\"><span id=\"total\">"+result.pages+"</span><span id=\"pageNum\" >"+result.pageNum+"</span></div>");
				$("#blog-pagenats").append("<li><a class=\"frist\" id=\"pre\" href=\"#\">上一页</a></li>");

				
				for(var i = 1; i <= result.pages; i++){
					if(i==result.pageNum){
						$("#blog-pagenats").append("<li><a style=\"background-color: #27a9e3\" class=\"page\" href=\"#\">"+i+"</a></li>");
					}else{
						$("#blog-pagenats").append("<li><a class=\"page\" href=\"#\">"+i+"</a></li>");
					}
				}
				$("#blog-pagenats").append("<li><a class=\"last\" id=\"next\" href=\"#\">下一页</a></li>");
				}	
		function show2(result){
			// 清空表格原始数据
			$("#blog-pagenats").empty();
			// 渲染表格中的数据
			
				// 渲染表格数据
				showData(result.data);
				$("#blog-pagenats").append("<div style=\"visibility:hidden\"><span id=\"total\">"+result.pages+"</span><span id=\"pageNum\" >"+result.pageNum+"</span></div>");
				$("#blog-pagenats").append("<li><a class=\"frist\" id=\"pre2\" href=\"#\">上一页</a></li>");

				
				for(var i = 1; i <= result.pages; i++){
					if(i==result.pageNum){
						$("#blog-pagenats").append("<li><a style=\"background-color: #27a9e3\" class=\"page2\" href=\"#\">"+i+"</a></li>");
					}else{
						$("#blog-pagenats").append("<li><a class=\"page2\" href=\"#\">"+i+"</a></li>");
					}
				}
				$("#blog-pagenats").append("<li><a class=\"last\" id=\"next2\" href=\"#\">下一页</a></li>");
				}
		
		function showData(result){
			// 清空表格原始数据
			$("#movieslist").empty();
			// 渲染表格中的数据
			$.each(result,function(index,movies){

				
				$("#movieslist").append("<tr>"
						+"<td>"+parseInt(index+1)+"</td>"
						+"<td class=\"w3-list-img\"><a class=\"movie\" data-id=\""+movies.movieId+"\" href=\"single.jsp?id="+movies.movieId+"\"><img src=\""+movies.moviePicture+"\" alt=\"\" /> <span>"+movies.movieName+"</span></a></td>"
						+"<td>"+movies.moviePublishDate+"</td>"
						+"<td>"+movies.movieDuration+"</td>"
						+"<td class=\"w3-list-info\">"+movies.countryName+"</td>"
						+"<td class=\"w3-list-info\"><a href=\"comedy.html\">"+movies.typeName+"</a></td>"
						+"<td>"+movies.movieRating+"</td>"
					  +"</tr>");
			});
		}
	</script>
<!-- //here ends scrolling icon -->
</body>
</html>